<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@page import ="java.util.*" %>
 <%@page import ="java.text.DecimalFormat"%>
 <%@ page import="java.sql.*" %>
<jsp:useBean id="db" class="ctm.javacode.dbBean"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>MenuDemo</title>
<script language="Javascript" type="text/javascript">
function check(onclick) {
	var foodwork_obj = document.getElementsByName("foodwork");
	var foodwork_len = foodwork_obj.length;
	var i;
	for(i=0;i<foodwork_len;i++){
		foodwork_obj[i].checked = false;
	}
	var str = onclick;
	document.getElementById(str).checked = true;
	document.menuform.submit();	
}
</script>

<style type="text/css">
body,td,th {
	color: #000000;
	font-size:20px;
	font-family:"標楷體";
}
.HEAD_STYLE {
	font-weight:bold;
	color: #437A27;
	font-family:"標楷體";
	font-size:30px; 
}
span{
	color: #000000;
	font-size:24px;
	font-family:"標楷體";
	font-weight:bold;
	
}
.button
{
	border:1px;
	padding-top: 4px;
	padding-right: 7px;
	padding-bottom: 4px;
	padding-left: 7px;
	background-color: #468129;
	color: #FFFFFF;
	font-size: 16px;
	border-color: #3C7023;
}

body {
	background-image: url(img/grass.jpg);
    background-position: center top;
	background-color: #FFFFFF;
	background-repeat: repeat;
}

.food {
	background-image: url(img/food.jpg);
	background-color: #FFFFFF;
	background-repeat: no-repeat; 
}

a:link {
	text-decoration:none;
	font-family:Arial;
	font-size:20px;
	color:#FFFFFF;
}
a:visited {
	text-decoration:none;
	font-family:Arial;
	font-size:20px;
	color:#FFFFFF;
}
a:hover {
	text-decoration:none;
	font-family:Arial;
	font-size:20px;
	color:#000000;
}

.class2 a:link {
	text-decoration: none;
	font-family: "標楷體";
	font-size: 20px;
	color: #000000;
}

.class2 a:visited {
	text-decoration: none;
	font-family: "標楷體";
	font-size: 20px;
	color: #000000;
}

.class2 a:active {
	text-decoration: none;
	font-family: "標楷體";
	font-size: 20px;
	color: #0000FF;
}

.class2 a:hover {
	text-decoration: none;
	font-family: "標楷體";
	font-size: 20px;
	color: #0000FF;
}

.ind:link {
	color: #535353;
	text-decoration:none;
	font-family:"標楷體";
	font-size:18px;
}
.ind:visited {
	color:#535353;
	text-decoration:none;
	font-family:"標楷體";
	font-size:18px;
}

.ind:hover {
	color:#BB280F;
	text-decoration:none;
	font-family:"標楷體";
	font-size:18px;
}

.TEXT_STYLE {
	font-family:"標楷體";  
	color:#437A27;
	font-size:24px;
}
.TEXT_STYLE_2 {
	font-family:"標楷體";  
	color:#000000;
	font-size:24px;
}
.BOTTOM_STYLE {
	color: #FFFFFF; 
	font-family: Arial; 
	font-size:20px;
}
.LEFT_BUTTON {
	font-family:"標楷體"; 
	font-size:30px;
}

.style {
	font-size: 20px; 
	color: #000000; 
	font-weight: bold;
}
.off {
	display: none;
}


</style>

</head>
<body  alink="#FF0000" vlink="#FF0000">

<%
String work = (String) request.getAttribute("work");
double calofday = Double.parseDouble(request.getAttribute("calofday").toString()) ;

double cho = Double.parseDouble(request.getAttribute("cho").toString()) ;
double fat = Double.parseDouble(request.getAttribute("fat").toString()) ;
double prot = Double.parseDouble(request.getAttribute("prot").toString()) ;

double proportion_prot = Double.parseDouble(request.getAttribute("proportion_prot").toString());
double proportion_fat = Double.parseDouble(request.getAttribute("proportion_fat").toString());
double proportion_cho = Double.parseDouble(request.getAttribute("proportion_cho").toString());

double quantity_Milk = Double.parseDouble(request.getAttribute("quantity_Milk").toString());
double quantity_Veg = Double.parseDouble(request.getAttribute("quantity_Veg").toString()); 
double quantity_Fruit = Double.parseDouble(request.getAttribute("quantity_Fruit").toString());
double quantity_Grain = Double.parseDouble(request.getAttribute("quantity_Grain").toString());
double quantity_Meat = Double.parseDouble(request.getAttribute("quantity_Meat").toString());
double quantity_Fat = Double.parseDouble(request.getAttribute("quantity_Fat").toString());

double img_Grain = Double.parseDouble(request.getAttribute("img_Grain").toString());
double img_Fat = Double.parseDouble(request.getAttribute("img_Fat").toString());

double breakfast_Milk = Double.parseDouble(request.getAttribute("breakfast_Milk").toString()) ;	
double lunch_Milk = Double.parseDouble(request.getAttribute("lunch_Milk").toString()) ;	
double dinner_Milk = Double.parseDouble(request.getAttribute("dinner_Milk").toString()) ;	

double breakfast_Veg = Double.parseDouble(request.getAttribute("breakfast_Veg").toString()) ;	
double lunch_Veg = Double.parseDouble(request.getAttribute("lunch_Veg").toString()) ;	
double dinner_Veg = Double.parseDouble(request.getAttribute("dinner_Veg").toString()) ;

double breakfast_Fruit = Double.parseDouble(request.getAttribute("breakfast_Fruit").toString()) ;	
double lunch_Fruit = Double.parseDouble(request.getAttribute("lunch_Fruit").toString()) ;	
double dinner_Fruit = Double.parseDouble(request.getAttribute("dinner_Fruit").toString()) ;	

double breakfast_Grain = Double.parseDouble(request.getAttribute("breakfast_Grain").toString()) ;	
double lunch_Grain = Double.parseDouble(request.getAttribute("lunch_Grain").toString()) ;	
double dinner_Grain = Double.parseDouble(request.getAttribute("dinner_Grain").toString()) ;	

double breakfast_Meat = Double.parseDouble(request.getAttribute("breakfast_Meat").toString()) ;	
double lunch_Meat = Double.parseDouble(request.getAttribute("lunch_Meat").toString()) ;	
double dinner_Meat = Double.parseDouble(request.getAttribute("dinner_Meat").toString()) ;	

double breakfast_Fat = Double.parseDouble(request.getAttribute("breakfast_Fat").toString()) ;	
double lunch_Fat = Double.parseDouble(request.getAttribute("lunch_Fat").toString()) ;	
double dinner_Fat = Double.parseDouble(request.getAttribute("dinner_Fat").toString()) ;

/*
    double calofday = Double.parseDouble(request.getSession().getAttribute("calofday").toString()) ;
    
	double cho = Double.parseDouble(request.getSession().getAttribute("cho").toString()) ;
    double fat = Double.parseDouble(request.getSession().getAttribute("fat").toString()) ;
    double prot = Double.parseDouble(request.getSession().getAttribute("prot").toString()) ;
    
    double proportion_prot = Double.parseDouble(request.getSession().getAttribute("proportion_prot").toString());
    double proportion_fat = Double.parseDouble(request.getSession().getAttribute("proportion_fat").toString());
    double proportion_cho = Double.parseDouble(request.getSession().getAttribute("proportion_cho").toString());
    
    double quantity_Milk = Double.parseDouble(request.getSession().getAttribute("quantity_Milk").toString());
	double quantity_Veg = Double.parseDouble(request.getSession().getAttribute("quantity_Veg").toString()); 
	double quantity_Fruit = Double.parseDouble(request.getSession().getAttribute("quantity_Fruit").toString());
	double quantity_Grain = Double.parseDouble(request.getSession().getAttribute("quantity_Grain").toString());
	double quantity_Meat = Double.parseDouble(request.getSession().getAttribute("quantity_Meat").toString());
	double quantity_Fat = Double.parseDouble(request.getSession().getAttribute("quantity_Fat").toString());
	
	double img_Grain = Double.parseDouble(request.getSession().getAttribute("img_Grain").toString());
	double img_Fat = Double.parseDouble(request.getSession().getAttribute("img_Fat").toString());
	
	double breakfast_Milk = Double.parseDouble(request.getSession().getAttribute("breakfast_Milk").toString()) ;	
	double lunch_Milk = Double.parseDouble(request.getSession().getAttribute("lunch_Milk").toString()) ;	
	double dinner_Milk = Double.parseDouble(request.getSession().getAttribute("dinner_Milk").toString()) ;	
	
	double breakfast_Veg = Double.parseDouble(request.getSession().getAttribute("breakfast_Veg").toString()) ;	
	double lunch_Veg = Double.parseDouble(request.getSession().getAttribute("lunch_Veg").toString()) ;	
	double dinner_Veg = Double.parseDouble(request.getSession().getAttribute("dinner_Veg").toString()) ;
	
	double breakfast_Fruit = Double.parseDouble(request.getSession().getAttribute("breakfast_Fruit").toString()) ;	
	double lunch_Fruit = Double.parseDouble(request.getSession().getAttribute("lunch_Fruit").toString()) ;	
	double dinner_Fruit = Double.parseDouble(request.getSession().getAttribute("dinner_Fruit").toString()) ;	
	
	double breakfast_Grain = Double.parseDouble(request.getSession().getAttribute("breakfast_Grain").toString()) ;	
	double lunch_Grain = Double.parseDouble(request.getSession().getAttribute("lunch_Grain").toString()) ;	
	double dinner_Grain = Double.parseDouble(request.getSession().getAttribute("dinner_Grain").toString()) ;	
	
	double breakfast_Meat = Double.parseDouble(request.getSession().getAttribute("breakfast_Meat").toString()) ;	
	double lunch_Meat = Double.parseDouble(request.getSession().getAttribute("lunch_Meat").toString()) ;	
	double dinner_Meat = Double.parseDouble(request.getSession().getAttribute("dinner_Meat").toString()) ;	
	
	double breakfast_Fat = Double.parseDouble(request.getSession().getAttribute("breakfast_Fat").toString()) ;	
	double lunch_Fat = Double.parseDouble(request.getSession().getAttribute("lunch_Fat").toString()) ;	
	double dinner_Fat = Double.parseDouble(request.getSession().getAttribute("dinner_Fat").toString()) ; */	
	
    DecimalFormat df = new DecimalFormat("0"); 
    DecimalFormat df2 = new DecimalFormat("#.#");
%>

<table width="100%" border="0">	
	<tr>
		<td><p>&nbsp;</p></td>
	</tr>
	<tr>					
		<td width="5%">&nbsp;</td>
		<td bgcolor="#FFFFFF">
			<table width="100%" border="0">
				<tr>
					<td background="img/herbal.jpg">
						<p>&nbsp;</p>
						<p>&nbsp;</p>
						<p>&nbsp;</p>
						<p>&nbsp;</p>
						<p>&nbsp;</p>
					</td>
				</tr>
				<tr>
					<td>
						<table bgcolor="#437A27" width="100%" border="0">
							<tr>
								<td>&nbsp;</td>
								<td width="15%" align="center">
									<a href="UserSuggest.do?work=<%=work%>" target="_new">飲食建議列印</a>
								</td>
								<td width="15%" align="center">
									<a href="main.jsp" target="_parent">回到主選單</a>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td>
						<table width="100%">
							<tr>
								<td valign="top">
									<table width="100%">
										<tr>
											<td class="HEAD_STYLE" align="center">每日建議熱量</td>
										</tr>
										<tr>
											<td >
<form name="printform" action="UserSuggest.do" method="post">
	<input type="hidden" id="work" value=<%=work%>></input>
	<input type="hidden" id="work" value="print"></input>
</form>
<table width="90%"align="center" border="1">
	<tr>
		
		<td align="center"><span>三大營養素</span></td>
		<td align="center"><span>建議熱量</span></td>	
	</tr>
	<tr>
		<td align="center"><span>蛋白質</span></td>
		<td align="center">
			<span id="wight" style=display:none><%=df.format(prot)%></span>
			<span id="prot"><%=df.format(prot)%></span><span>克(</span>
			<span id="proportion_prot"><%=df2.format(proportion_prot)%></span><span>%)</span>
		</td>	
			
	</tr>
	<tr>
	<td align="center"><span>脂肪</span></td>
	<td align="center">
		<span id="fat"><%=df.format(fat)%></span><span>克(30%)</span>
	 	</td>
	</tr>
	<tr>
	<td align="center"><span>醣類</span></td>
	<td align="center">
		<span id="cho"><%=df.format(cho)%></span><span>克(</span>
		<span id="proportion_cho"><%=df2.format(proportion_cho)%></span><span>%)</span></td>			
	</tr>	
	<tr>
	<td align="center"><span>總共</span></td>
	<td align="center"><span id="calofday"><%=df.format(calofday)%></span><span>大卡</span></td>	
	</tr>									

</table>

<br><br><br>
<table width="90%"align="center" border="1">
	<tr>
	<td align="center"><span>六大類食物</span></td> 
	<td align="center"><span>建議份量(±0.5份)</span></td>	
	</tr>
	<tr>
	<td align="center"><span>低脂奶類</span></td>
	<td align="center">
		<span><%=df2.format(quantity_Milk)%></span>
	</td>	
	</tr>
	<tr>
	<td align="center"><span>蔬菜類</span></td>
	<td align="center">
		<span><%=df2.format(quantity_Veg)%></span>
	</td>	
	</tr>
	<tr>
	<td align="center"><span>水果類</span></td>	
	<td align="center">
		<span><%=df2.format(quantity_Fruit)%></span>
	</td>	
	</tr>
	<tr>
	<td align="center"><span>全穀根莖類</span></td>
	<td align="center">
		<span id="quantity_Grain"><%=df2.format(quantity_Grain)%></span>
	</td>	
	</tr>
	<tr>
	<td align="center"><span>豆魚肉蛋類</span></td>
	<td align="center">
		<span id="quantity_Meat"><%=df2.format(quantity_Meat)%></span>
	</td>	
	</tr>	
	<tr>
	<td align="center"><span>油脂及堅果種子類</span></td>
	<td align="center">
		<span id="quantity_Fat"><%=df2.format(quantity_Fat)%></span>
	</td>	
	</tr>	
		
</table>

<a href="file:///D|/Dropbox/CCU/program/pllab/workspace/tcm/WebContent/ProSuggest.jsp">ProSuggest</a><br>
<form  name="menuform" action="fooddemo.do" method="post" target="iframe" >
<table height="400" width="918" align="center" class="food" rules="none" cellpadding="0">
	<tr>
    	<td width="136" height="147" class="style"></td>
		<td width="202" class="style"></td>
		<td width="213" class="style"></td>
		<td width="355" class="style"></td>
    </tr>
	<tr>
    	<td height="20" class="style"></td>
		<td class="style"></td>
		<td class="style">&nbsp;&nbsp;</td>
		<td class="style"></td>
    </tr>
	<tr>
    	<td height="20" class="style"></td>
		<td class="style"></td>
		<td class="style"><div class="class2" ><a href="javascript:check('rad1')" >&nbsp;&nbsp;&nbsp;全榖根莖類<br></a></div>
		<input type="radio" name="foodwork" value="1" class="off" id="rad1">
		</td>
		<td class="style">&nbsp;&nbsp;&nbsp;</td>
    </tr>
	<tr>
    	<td height="20" class="style"></td>
		<td class="style"><div class="class2" ><a href="javascript:check('rad2')" >
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;蔬菜類</a></div>
		<input type="radio" name="foodwork" value="2" class="off" id="rad2">
		</td>
		<td class="style">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="style"><%=df2.format(img_Grain) %>碗</span></td>
		<td class="style"><div class="class2" ><a href="javascript:check('rad3')" >豆魚肉蛋類</a></div>
		<input type="radio" name="foodwork" value="3" class="off" id="rad3">
		</td>
    </tr>
	<tr>
    	<td height="20" class="style"></td>
		<td class="style">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<span class="style"><%=df2.format(quantity_Veg)%>份</span>
		</td>
		<td class="style"></td>
		<td class="style">&nbsp;&nbsp;
			<%=df2.format(quantity_Meat)%>份
			&nbsp;&nbsp;</td>
    </tr>
	<tr>
    	<td height="20" class="style"></td>
		<td class="style">&nbsp;</td>
		<td class="style"></td>
		<td class="style"><div class="class2" ><a href="javascript:check('rad4')" >
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;低脂奶類</a></div>
		<input type="radio" name="foodwork" value="4" class="off" id="rad4">
		</td>
    </tr>
	<tr>
    	<td height="20" class="style"></td>
		<td class="style">&nbsp;&nbsp;&nbsp;&nbsp;</td>
		<td class="style"></td>
		<td class="style">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<%=df.format(quantity_Milk*240)%>毫升</td>
    </tr>
	<tr>
    	<td height="20" class="style"></td>
		<td class="style"><div class="class2" ><a href="javascript:check('rad5')" >&nbsp;&nbsp;&nbsp;&nbsp;
			水果類</a></div>
			<input type="radio" name="foodwork" value="5" class="off" id="rad5">
		</td>
		<td class="style"></td>
		<td class="style">&nbsp;</td>
    </tr>
	<tr>
    	<td height="20" class="style"></td>
		<td class="style">&nbsp;&nbsp;&nbsp;&nbsp;<span class="style15"></span><span class="style6">&nbsp;<strong class="style"><%=df2.format(quantity_Fruit)%>份</strong></span></td>
		<td class="style"></td>
		<td class="style"><div class="class2" ><a href="javascript:check('rad6')" >&nbsp;油脂<%=df2.format(img_Fat)%>湯匙及堅果種子類1份</a></div>
		<input type="radio" name="foodwork" value="6" class="off" id="rad6">
		</td>
    </tr>
</table>
</form>

<br>
<table width="90%"align="center" border="1">
	<tr>
		<td align="center"><span>六大類食物</span></td> 
		<td align="center"><span>早餐</span></td>	
		<td align="center"><span>午餐</span></td>
		<td align="center"><span>晚餐</span></td>
	</tr>
	<tr>
		<td align="center"><span>低脂奶類</span></td>
		<td align="center">
			<span><%=df2.format(breakfast_Milk)%></span>		
		</td>	
		<td align="center">
			<span><%=df2.format(lunch_Milk)%></span>	
		</td>			
		<td align="center">
			<span><%=df2.format(dinner_Milk)%></span>	
		</td>					
	</tr>
	<tr>
		<td align="center"><span>蔬菜類</span></td>
		<td align="center">
			<span><%=df2.format(breakfast_Veg)%></span>	
		</td>		
		<td align="center">
			<span><%=df2.format(lunch_Veg)%></span>	
		</td>				
		<td align="center">
			<span><%=df2.format(dinner_Veg)%></span>	
		</td>	
	</tr>
	<tr>
		<td align="center"><span>水果類</span></td>	
		<td align="center">
			<span><%=df2.format(breakfast_Fruit)%></span>	
		</td>		
		<td align="center">
			<span><%=df2.format(lunch_Fruit)%></span>	
		</td>				
		<td align="center">
			<span><%=df2.format(dinner_Fruit)%></span>	
		</td>
	</tr>	
	<tr>
		<td align="center"><span>全穀根莖類</span></td>
		<td align="center">
			<span><%=df2.format(breakfast_Grain)%></span>	
		</td>		
		<td align="center">
			<span><%=df2.format(lunch_Grain)%></span>	
		</td>				
		<td align="center">
			<span><%=df2.format(dinner_Grain)%></span>	
		</td>	
	</tr>
	<tr>
		<td align="center"><span>豆魚肉蛋類</span></td>
		<td align="center">
			<span><%=df2.format(breakfast_Meat)%></span>	
		</td>		
		<td align="center">
			<span><%=df2.format(lunch_Meat)%></span>	
		</td>				
		<td align="center">
			<span><%=df2.format(dinner_Meat)%></span>	
		</td>	
	</tr>	
	<tr>
		<td align="center"><span>油脂及堅果種子類</span></td>
		<td align="center">
			<span><%=df2.format(breakfast_Fat)%></span>	
		</td>		
		<td align="center">
			<span><%=df2.format(lunch_Fat)%></span>	
		</td>				
		<td align="center">
			<span><%=df2.format(dinner_Fat)%></span>	
		</td>	
	</tr>	
		
</table> <br>
										
											</td>
										</tr> 
										<tr><center>
											<td align="center"><input class="button" type="button" value="回到主選單" onClick="location='main.jsp'"/></td>
											</center>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td><p>&nbsp;</p></td>
				</tr>
				<tr>
					<td bgcolor="#437A27">
						<div align="center" class="BOTTOM_STYLE">Copyright@ITRI and CCU_PLlab</div>
					</td>
				</tr>		
			</table>
		</td>
		<td width="5%">&nbsp;</td>
	</tr>			
</table>
<p>&nbsp;</p>





</body>
</html>
